/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tickets.tickets;

import java.util.Date;
import java.util.Objects;

/**
 * Incapsulates data about applying ticket to turnstile 
 * @author Hlib_Babii
 */
public class Passage {

    private Ticket ticket;
    private Date time;
    private PassageState passageState;
    

    Passage(Ticket ticket, Date time, PassageState passageState) {
        this.ticket = ticket;
        this.time = time;
        this.passageState = passageState;
    }

    public Ticket getTicket() {
        return ticket;
    }

    void setTicket(Ticket ticket) {
        this.ticket = ticket;
    }

    public Date getTime() {
        return time;
    }

    void setTime(Date time) {
        this.time = time;
    }

    public PassageState getPassageState() {
        return passageState;
    }

    void setPassageState(PassageState passageState) {
        this.passageState = passageState;
    }
    
    @Override
    public int hashCode() {
        int hash = 3;
        hash = 97 * hash + Objects.hashCode(this.ticket);
        hash = 97 * hash + Objects.hashCode(this.time);
        hash = 97 * hash + Objects.hashCode(this.passageState);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Passage other = (Passage) obj;
        if (!Objects.equals(this.ticket, other.ticket)) {
            return false;
        }
        if (!Objects.equals(this.time, other.time)) {
            return false;
        }
        if (this.passageState != other.passageState) {
            return false;
        }
        return true;
    }
}
